import { stringToHash, formatToString } from "../utils";
import { AbstractModel } from "../types";
/**
 * 模型：字符串,
 * 属性：字符串，
 */
export class MyString extends AbstractModel {
  static common(data: number): MyString {
    return new MyString(data + "");
  }
  constructor(private _string: string) {
    super();
  }
  get string(): string {
    return this._string;
  }
  get hash(): number {
    return stringToHash(this._string);
  }
  equals(obj: unknown): boolean {
    return this._string === obj;
  }
  toString(): string {
    return formatToString("MyString", ["string", this.string]);
  }
}
